/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-06-22
 * Time: 22:31
 */
class Solution {
    public int[] productExceptSelf(int[] nums) {
        int n = nums.length;
        int[] answer = new int[n];
        int[] L = new int[n];
        int[] R = new int[n];
        L[0] = 1;
        for(int i = 1; i < n; i++) {
            L[i] = L[i-1] * nums[i-1];
        }
        R[n-1] = 1;
        for(int i = n - 2; i >= 0; i--) {
            R[i] = R[i+1] * nums[i+1];
        }

        for(int i = 0; i < n; i++) {
            answer[i] = L[i] * R[i];
        }

        return answer;
    }
}
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello world!");
    }
}